home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / DOCS / ST_GUIDE.PR / EXCEPTNS.TXT < prev    next >
Encoding:
Text File  |  1989-12-31  |  6.7 KB  |  134 lines

  1. PRT_LINE x1k1                        ┌─────────────────────┐
  2.                         │ EXCEPTION PROCEDURE │
  3.                         └─────────────────────┘
  4. EXCEPTION:
  5.   move SR,SR_Saved
  6.   set S
  7.   clr T
  8.   if Exception = Reset
  9.   then RESET
  10.   endif
  11.   if Exception = Interrupt
  12.   then move Interrupt_Pending_Level,I0_I1_I2
  13.     if Exception = Auto_Vector_Interrupt
  14.     then Vector# = 24+I0_I1_I2
  15.     else (Exception=Non_Auto_Vector_Interrupt) MC68901 gives Vector#
  16.     (if MC68901 non Reseted then Vector# = 15)
  17.       if Bus Error
  18.       then Vector# = 24 (Parasit Interrupt)
  19.       endif
  20.     endif
  21.   else calculate Vector#
  22.   endif
  23.   mul #4,Vector#
  24.   move.l PC,-(SSP)
  25.   move SR_Saved,-(SSP)
  26.   if Bus Error or Address Error
  27.     if it is the 1rst Bus Error or Address Error
  28.     then EXCEPTION
  29.     else HALT
  30.     endif
  31.   endif
  32.   if Exception = Bus Error or Address Error (cause to prefetch: PC=PC+2 ... +10)
  33.     move Instruction_Register,-(SSP)
  34.     move.l Fault_address,-(SSP)
  35.     move Processor_State,-(SSP) (b0-b2=FC0-FC2  b3=I/N  b4=R/W)
  36.        *FUNCTION CODES        FC2 FC1 FC0
  37.         User Data              0   0   1
  38.         User Programm          0   1   0
  39.         Super Data             1   0   1
  40.         Super Programm         1   1   0
  41.         Interrupt Acknowledge  1   1   1
  42.          -                       Other
  43.        *I/N Instruction/exceptioN
  44.         0: Instruction TRAP TRAPV CHK DIV0
  45.         1: Reset Bus/Address_Error Trace Interrupt Illegal Line_A/F
  46.            & Privilege_Violation
  47.        *R/W  1:Read  0:Write
  48.   endif
  49.   move.l (Vector#),PC
  50.   if Bus Error
  51.     if it is the 1rst Bus Error or Address Error
  52.     then EXCEPTION
  53.     else HALT
  54.     endif
  55.   endif
  56.   ...
  57. RTE
  58.  
  59. HALT: wait RESET
  60. RESET:
  61.   move #%111,I0_I1_I2
  62.   move #0,Vector#
  63.   mul #4,Vector#
  64.   move.l (Vector#),SSP
  65.   move #1,Vector#
  66.   mul #4,Vector#
  67.   move.l (Vector#),PC
  68.   ...
  69.                              ┌───────────────────────────┐
  70.                              │ EXCEPTION PRIORITY LEVELS │
  71.                 ┌────────────┼───────────────────────────┤
  72.                 │ High level │    Reset                  │
  73.                 │            │    Bus Error              │
  74.                 │            │    Address Error          │
  75.                 │            │    Trace                  │
  76.                 │            │    Interrupt              │
  77.                 │            │    Illegal                │
  78.                 │            │    Line_A Line_F          │
  79.                 │            │    Privilege Violation    │
  80.                 │  Low level │    TRAP TRAPV CHK DIV0    │
  81.                 └────────────┴───────────────────────────┘
  82.                              ┌───────────────────────────┐
  83.                              │ INTERRUPT PRIORITY LEVELS │
  84. ┌────────────────────────────┴───────────────────────────┴─────────────────────┐
  85. │          Interrupt if IPL2_IPL1_IPL0 >= I2_I1_I0 (Excepted for NMI)          │
  86. ├────┬────┬────┬───────────────────────────────────────────────────────────────┤
  87. │IPL2│IPL1│IPL0│                        Interrupt                              │
  88. ├────┼────┼────┼───────────────────────────────────────────────────────────────┤
  89. │  1 │  1 │  1 │ (Non Maskable Interrupt , Expand Port)                        │
  90. ├────┼────┼────┼───────────────────────────────────────────────────────────────┤
  91. │  1 │  1 │  0 │ MC68901                                                       │
  92. ├────┼────┼────┼───────────────────────────────────────────────────────────────┤
  93. │  1 │  0 │  1 │ (Expand Port)                                                 │
  94. ├────┼────┼────┼───────────────────────────────────────────────────────────────┤
  95. │  1 │  0 │  0 │ Vertival BLanking                                             │
  96. ├────┼────┼────┼───────────────────────────────────────────────────────────────┤
  97. │  0 │  1 │  1 │ (Expand Port)                                                 │
  98. ├────┼────┼────┼───────────────────────────────────────────────────────────────┤
  99. │  0 │  1 │  0 │ Horizontal BLanking                                           │
  100. ├────┼────┼────┼───────────────────────────────────────────────────────────────┤
  101. │  0 │  0 │  1 │ -                                                             │
  102. ├────┼────┼────┼───────────────────────────────────────────────────────────────┤
  103. │  0 │  0 │  0 │ No Interrupt                                                  │
  104. └────┴────┴────┴───────────────────────────────────────────────────────────────┘
  105.                                 ╔═══════════════════╗
  106.                                 ║ EXCEPTION VECTORS ║
  107. ╔═════════╤═════════╤═══════════╩═══════════════════╩══════════════════════════╗
  108. ║Address $│ Vector# │   Exception                                              ║
  109. ╟─────────┼─────────┼──────────────────────────────────────────────────────────╢
  110. ║     0/4 │     0/1 │   Reset SSP / PC                                         ║
  111. ║       8 │       2 │   Bus Error                                              ║
  112. ║       C │       3 │   Address Error                                          ║
  113. ║      10 │       4 │   Illegal Instructions                                   ║
  114. ║      14 │       5 │   DIV by 0 Instruction                                   ║
  115. ║      18 │       6 │   CHK Instruction                                        ║
  116. ║      1C │       7 │   TRAPV Instruction                                      ║
  117. ║      20 │       8 │   Privilege Violation                                    ║
  118. ║      24 │       9 │   Trace                                                  ║
  119. ║      28 │      10 │   $Axxx Instructions                                     ║
  120. ║      2C │      11 │   $Fxxx Instructions                                     ║
  121. ║   30-38 │   12-14 │   -                                                      ║
  122. ║      3C │      15 │   Non Reseted Interrupt                                  ║
  123. ║   40-5C │   16-23 │   -                                                      ║
  124. ║      60 │      24 │   Parasit Interrupt                                      ║
  125. ║      64 │      25 │   Auto_Vector Interrupt    #1= -                         ║
  126. ║      68 │      26 │   Auto_Vector Interrupt    #2= Horizontal BLanking       ║
  127. ║      6C │      27 │   Auto_Vector Interrupt    #3= -                         ║
  128. ║      70 │      28 │   Auto_Vector Interrupt    #4=   Vertical BLanking       ║
  129. ║   74-7C │   29-31 │   Auto_Vector Interrupt  #5-7= -                         ║
  130. ║   80-BC │   32-47 │   TRAP Instruction      #0-15                            ║
  131. ║   C0-FC │   48-63 │   -                                                      ║
  132. ║ 100-3FC │  64-255 │   Non_Auto_Vector Interrupts                             ║
  133. ╚═════════╧═════════╧══════════════════════════════════════════════════════════╝
  134.